<template>
  <svg
    :class="['icon', customClass]"
    aria-hidden="true"
    :style="`width: ${this.size}px; height: ${this.size}px;`"
  >
    <use :xlink:href="`#icon-${this.name}`"></use>
  </svg>
</template>

<script lang="ts">
import { defineComponent } from "vue";

export default defineComponent({
  name: "SvgIcon",
  props: {
    name: {
      // icon 名称
      type: String,
      require: true
    },
    size: {
      type: Number,
      default: 20
    },
    customClass: {
      type: String,
      default: ""
    }
  }
});
</script>

<style lang="scss">
.icon {
  fill: currentColor;
  overflow: hidden;
}
</style>
